package com.xiaode.controller.admin.journal;

import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;
import com.jfinal.core.Path;
import com.jfinal.ext.cors.EnableCORS;
import com.jfinal.kit.Ret;
import com.xiaode.common.anotation.Authority;
import com.xiaode.util.apidoc.annotation.Api;
import com.xiaode.util.apidoc.annotation.ApiOper;
import com.xiaode.util.apidoc.annotation.ApiPara;

import javax.validation.constraints.NotEmpty;
import java.util.Date;

@Path("/aJournal")
@Api("日志相关")
@EnableCORS
public class JournalController extends Controller {
    @Inject
    private JournalService service;

    @ApiOper("日志查询")
    @Authority(description = "日志查询", permission = "admin:aJournal:findJournal", permissionParentName = "日志模块", permissionName = "日志管理",type = 1)
    public void findJournal(@ApiPara(value = "startDate",notes = "开始时间")Date startDate,
                            @ApiPara(value = "endDate",notes = "结束时间")Date endDate,
                            @ApiPara(value = "name",notes = "用户名")String name,
                            @ApiPara(value = "account",notes = "工号")String account,
                            @ApiPara(value = "角色",notes = "roleId")Integer roleId,
                            @NotEmpty @ApiPara(value = "page",notes = "当前页")Integer page,
                            @NotEmpty @ApiPara(value = "limit",notes = "每页大小")Integer limit)throws Exception{
        Ret ret = service.findJournal(startDate,endDate,name,roleId,account,page,limit);
        renderJson(ret);
    }

}
